addpath(genpath(pwd));

root = './../_FGS/';

src_root = [ root 'src/' ];

path = dir( src_root );

for i = 3: length(path)
    fname = path(i).name;
    
    if(length(fname) < 4 ), continue, end
    
    if(~strcmp(fname(end-3:end) ,'.jpg' )) , continue, end        
	
	disp(fname);
        
	try
		A = imread( [src_root fname] );
	catch
		disp([fname ' break']);
		continue;
	end
    
    B = Gb_CSG( A);
    
    B = uint8(B * 255.0);        
    
    imwrite(B,[root 'Pb_output/' fname]);    
        
end